package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.math.BigDecimal;

/**
 * 购物车表
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/9/12 22:29
 */
@Data
@TableName("ps_shopping_cart")
public class ShoppingCart extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 隶属用户
     */
    @CheckNotNull(message = "请选择所属用户", groups = UpdGroup.class)
    private String userId;
    /**
     * 物品名称
     */
    @CheckLength(min = 1, max = 200, message = "物品名称超过长度限制")
    @CheckNotNull(message = "请输入物品名称")
    private String name;
    /**
     * 商品类型
     * @see Dict#getId()
     */
    @CheckNotNull(message = "请选择商品类型")
    private String typeId;
    /**
     * 链接地址-商品
     */
    private String path;
    /**
     * 详情
     */
    private String details;
    /**
     * 买入价格
     */
    private BigDecimal price;
    /**
     * 是否购买
     * @see com.sprouting.personal.interfaces.common.Constant.YesOrNo#YES 已购买
     */
    @NotNull(message = "请选择是否已经购买")
    private Integer purchase;
    /**
     * 推荐理由
     */
    @CheckLength(min = 1, max = 600, message = "推荐理由超过长度限制")
    @CheckNotNull(message = "请输入推荐理由")
    private String reason;
    /**
     * 评分
     */
    @NotNull(message = "请对物品进行评分")
    private Integer grade;
}
